package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipRepairReplacePartService;
import cc.comac.mom.bean.EquipRepair;
import cc.comac.mom.bean.EquipRepairReplacePart;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value = "/EquipRepairReplacePart")
public class EquipRepairReplacePartController {

	@Autowired
	private EquipRepairReplacePartService equipRepairReplacePartService;

	@ApiOperation("批量插入备件信息")
	@RequestMapping("/insertBatch")
	public ResultBean insertBatch(@RequestBody List<EquipRepairReplacePart> list) {
		return equipRepairReplacePartService.insertBatch(list);
	}

	@ApiOperation("修改备件信息")
	@RequestMapping("/update")
	public ResultBean update(@RequestBody EquipRepairReplacePart obj) {
		return equipRepairReplacePartService.update(obj);
	}

	@ApiOperation("删除备件信息")
	@RequestMapping("/delete")
	public ResultBean delete(@RequestBody EquipRepairReplacePart obj) {
		return equipRepairReplacePartService.delete(obj);
	}

	@ApiOperation("批量删除备件信息")
	@RequestMapping("/deleteBatch")
	public ResultBean deleteBatch(@RequestBody List<Long> ids) {
		return equipRepairReplacePartService.deleteBatch(ids);
	}

	@ApiOperation("获取维修知识库备件信息")
	@RequestMapping("/getPartInfo")
	public ResultBean getPartInfo(@RequestBody EquipRepair obj) {
		return equipRepairReplacePartService.getPartInfo(obj);
	}

	@ApiOperation("需求确认按钮")
	@RequestMapping(value = "/repairReplacePartDemandConfirm", method = RequestMethod.POST)
	public ResultBean repairReplacePartDemandConfirm(@RequestBody List<EquipRepairReplacePart> repairReplacePartList) {
		ResultBean repairReplacePartDemandConfirm = equipRepairReplacePartService.repairReplacePartDemandConfirm(repairReplacePartList);
		return repairReplacePartDemandConfirm;
	}
	@ApiOperation("更换确认按钮")
	@RequestMapping(value = "/repairReplacePartReplaceConfirm", method = RequestMethod.POST)
	public ResultBean repairReplacePartReplaceConfirm(@RequestBody List<EquipRepairReplacePart> repairReplacePartList) {
		ResultBean repairReplacePartReplaceConfirm = equipRepairReplacePartService.repairReplacePartReplaceConfirm(repairReplacePartList);
		return repairReplacePartReplaceConfirm;
	}

	@ApiOperation("分页查询备件信息")
	@RequestMapping("/selectByCondition")
	public ResultBean selectByCondition(@RequestBody EquipRepairReplacePart obj) {
		return equipRepairReplacePartService.selectByCondition(obj);
	}
}
